package com.wanmait.employment.manageController;

import com.github.pagehelper.PageInfo;
import com.wanmait.employment.entity.Company;
import com.wanmait.employment.entity.Publisher;
import com.wanmait.employment.mapper.PublisherMapper;
import com.wanmait.employment.service.PublisherService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("manage/publisher")
public class PublisherConteroller {
    @Resource
    private PublisherMapper publisherMapper;
    @Resource
    private PublisherService publisherService;


    @GetMapping("list")
    @ResponseBody
    public AjaxResult list(String publishername,Integer pageNum,Integer pageSize){
        PageInfo<Publisher> pageInfo=publisherService.list(publishername,pageNum,pageSize);
        return AjaxResult.success("",pageInfo);

    }
    @GetMapping("resetpasswords")
    public AjaxResult resetpasswords( Integer id){
        String password="123456";
        publisherService.resetpasswords(id,password);
        return AjaxResult.success("重置成功");
    }
    @GetMapping("resetpic")
    public AjaxResult resetpic( Integer id){
        String pic="static/image/BOSS.png";
        publisherService.resetpic(id,pic);
        return AjaxResult.success("重置成功");
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody  Publisher publisher){
        publisherService.update(publisher);
        return AjaxResult.success("修改成功");


    }
    @GetMapping("delete")
    public AjaxResult delete(Integer id){
        publisherService.delete(id);
        return AjaxResult.success("删除成功");

    }





}
